﻿<UserControl x:Class="DomusDotNet.Sbm.Client.SL4.Views.SearchView"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
			 xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
			 xmlns:tk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
			 xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
			 mc:Ignorable="d"
			 d:DesignHeight="300"
			 d:DesignWidth="400">


	<Border Style="{StaticResource GreenPanel}"
			MaxWidth="920">
		<tk:BusyIndicator Name="BusyState_IsSet">

			<Grid Margin="20">
				<Grid.RowDefinitions>
					<RowDefinition Height="auto" />
					<RowDefinition Height="auto" />
					<RowDefinition Height="auto" />
					<RowDefinition Height="*" />
					<RowDefinition Height="auto" />
				</Grid.RowDefinitions>

				<TextBlock FontSize="16">Ricerca</TextBlock>
				<StackPanel Grid.Row="1">
					<TextBlock>Titolo</TextBlock>
					<TextBox Name="Criteria_TitleFilter" />

					<TextBlock>Autore</TextBlock>
					<TextBox Name="Criteria_AuthorFilter" />


					<StackPanel Orientation="Horizontal">

						<StackPanel Width="200">
							<TextBlock>Pubblicazione: da</TextBlock>
							<sdk:DatePicker Name="Criteria_PublishDateFromFilter" />

						</StackPanel >
						<StackPanel Width="200"
									Margin="20 0 0 0">
							<TextBlock>a</TextBlock>
							<sdk:DatePicker Name="Criteria_PublishDateToFilter" />

						</StackPanel>
					</StackPanel>




					<StackPanel Orientation="Horizontal"
								HorizontalAlignment="Right">

						<Button Name="Clear"
								Margin="20 0 0 0"
								Content="Azzera" />
						<Button Name="Search"
								Margin="20 0 0 0"
								Content="Cerca" />
					</StackPanel>


				</StackPanel>

				<TextBlock Name="ErrorMessage"
						   Style="{StaticResource Error}" />



				<ListBox Name="Books"
						 Grid.Row="3"
						 HorizontalContentAlignment="Stretch">
					<ListBox.ItemContainerStyle>
						<Style TargetType="ListBoxItem">
							<Setter Property="HorizontalContentAlignment"
									Value="Stretch" />
						</Style>
					</ListBox.ItemContainerStyle>
					<ItemsControl.ItemTemplate>
						<DataTemplate>
							<Grid>
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="*" />
									<ColumnDefinition Width="auto" />
								</Grid.ColumnDefinitions>
								
								<ContentControl cal:View.Model="{Binding}"
												HorizontalContentAlignment="Stretch" />

								<Button Grid.Column="1"
										Margin="5"
										HorizontalAlignment="Center"
										VerticalAlignment="Center"
										cal:Message.Attach="ShowBookDialog($dataContext)"
										Content="Dettaglio"></Button>
							</Grid>

						</DataTemplate>

					</ItemsControl.ItemTemplate>
				</ListBox>


				<StackPanel Orientation="Horizontal"
							Grid.Row="4"
							HorizontalAlignment="Right"
							Margin=" 0 10 0 0 ">


					<Button cal:Message.Attach="[Event Click]  = [ ShowBook(Books.SelectedItem) ]"
							Margin="20 0 0 0"
							Content="Visualizza" />

				</StackPanel>

			</Grid>
		</tk:BusyIndicator>
	</Border>
</UserControl>
